From: Colin Walters Date: Mon, 31 Jul 2017 13:31:55 +0000 (-0400) Subject: tests/lzma: Use GRand over random() X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~33^2~58 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=5daae8629e84444879e7c94ccc990b7b906c58a6;p=ostree.git tests/lzma: Use GRand over random() It's designed for test suites and non-critical random uses like this. This silences a Coverity warning about weak randomness. Closes: #1037 Approved by: jlebon --- diff --git a/tests/test-lzma.c b/tests/test-lzma.c index 1f7d2559..b3487ee3 100644 --- a/tests/test-lzma.c +++ b/tests/test-lzma.c @@ -81,9 +81,9 @@ test_lzma_random (void) gssize i; const guint32 buffer_size = 4096 + 1; guint8 buffer[buffer_size]; - srandom (1); + g_autoptr(GRand) r = g_rand_new (); for (i = 0; i < buffer_size; i++) - buffer[i] = random (); + buffer[i] = g_rand_int (r); for (i = 2; i <= buffer_size; i *= 2) {